<?php

/**
 * videos actions.
 *
 * @package    sf_sandbox
 * @subpackage videos
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class videosActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {

  }
  
  /**
   * Liste des videos d'un defi
   * @param unknown_type $request
   */
  public function executeDefis(sfWebRequest $request)
  {
  	$id = $request->getParameter('id');
  	$this->oDefis = Doctrine::getTable('Defis')->find($id);
  	$this->forward404If(!$this->oDefis);
  	$this->aVideos = MediasTable::getListDefis($id, 'video');
  }
  
  /**
   * Ajoute une vidéo à un défis
   * L'utilisateur doit faire parti du defis et doit être connecté
   * @param sfWebRequest $request
   */
  public function executeAjout(sfWebRequest $request)
  {
  
  }
  
  public function executeFiche(sfWebRequest $request)
  {
  	$id = $request->getParameter('id');
  	$this->oMedia = Doctrine::getTable('Medias')->find($id);
  	$this->forward404If(!$this->oMedia);
  	$this->sUrlIframe = DailymotionMedia::get_embed_url($this->oMedia->dailymotion_id);
  }  

  public function executeAjaxEmbedVid(sfWebRequest $request)
  {
  	$id = $request->getParameter('id');
  	$this->oMedia = Doctrine::getTable('Medias')->find($id);
  	$this->forward404If(!$this->oMedia);
  	$this->sUrlIframe = DailymotionMedia::get_embed_url($this->oMedia->dailymotion_id);
  }
}
